package com.ovopark.organize.server.model.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

/**
 * 加盟商 商业立项模版 分组
 */
@Data
@TableName("is_franchisees_approval_template_section")
public class FranchiseesApprovalTemplateSection implements Serializable {

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    // 企业id
    private Integer groupId;
    // 模版id
    private Integer templateId;
    // 分组名称
    private String name;
    // 创建人id
    private Integer userId;
    // 创建时间
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;
    // 1删除0正常
    private Integer isDeleted;
    // 排序
    private Integer sort;
    // 版本信息
    private String version;
    // 字段列表
    @TableField(exist = false)
    private List<FranchiseesApprovalTemplateField> fields;
    // 字段列表
    @TableField(exist = false)
    private List<FranchiseesApprovalTemplateFieldValue> values;

    @Override
    public boolean equals(Object obj) {
        if (this == obj)
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        FranchiseesApprovalTemplateSection other = (FranchiseesApprovalTemplateSection) obj;
        if (name == null) {
            return other.name == null;
        } else return name.equals(other.name);
    }
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((name == null) ? 0 : name.hashCode());
        return result;
    }
}
